package com.example.serverclient.demo.rest;

import com.example.serverapi.demo.ServerApi;
import com.example.serverclient.demo.aop.CheckToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class ClientRest {
    @Autowired
    private ServerApi serverApi;

    @GetMapping("/feignClient")
    public Map<String, Object> feignClient(@RequestParam("name") String name) {
        Map<String, Object> stringObjectMap = serverApi.hello(name);
        return stringObjectMap;
    }

    @CheckToken
    @GetMapping("/login")
    public String login(@RequestParam("name") String name) {
        return "登录成功";
    }
}
